<template>

  <form
          id="myForm"
          enctype="multipart/form-data"
          name="fileinfo"
          action=""
          target="uploadFrame"
  >
    <div class="img-file">
      <label for="imgFile" class="addbutton button-green">选择视频</label><hr>
      <input
              @change="changeVideo"
              id="imgFile"
              class="upload_input"
              type="file"
              accept="video/*"
      />
    </div>
  </form>
</template>

<script>
    export default {
        name: "fileinfo",
        data() {
            return {}
        },

        methods:{
       changeVideo() {
           let that = this;
           var file = document.getElementById("imgFile").files[0];
           that.file = file;
           var ids = this.ids;
           var formData = new FormData(); //构造一个 FormData，把后台需要发送的参数添加
           if (file) {
               formData.append("file", file); //接口需要传递的参数
           }
           let potss = formData;
           let urls = "http:url地址";
           axios
               .post(urls, potss)
               .then(function(res) {
                   that.prames.videoUrl = res.data.info;
                   that.videoshow = false;
               })
               .catch(function(err) {
                   console.log(err);
               });
       }
     }
   }
</script>
